package cn.goktech.controller;

import cn.goktech.entity.User;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

/**
 * @Classname SearchController
 * @Description TODO
 * @Date 2021/2/3 23:53
 * @Created by 刘岳辉
 */
@RestController
public class SearchController {

    @Value("${server.port}")
    private String port;

    @GetMapping("/find")
    public String find(){
        return "正在访问Client1的"+port;
    }

    @GetMapping("/findById/{id}")
    public User findById(@PathVariable Integer id){
        return new User(id,"张三",20+id);
    }

    @GetMapping("/getUser")
    public User getUser(@RequestParam Integer id,@RequestParam String name){
        return new User(id,name,20+id);
    }

    @PostMapping("/save")
    public User save(@RequestBody User user){
        return user;
    }
}
